#pragma once

#include "action.h"

class Action_ReferencedChanged : public Action
{
	/** what refrenced changed it's value as a result of a button being pushed */
	int * m_reference;
	/** old value being referenced */
	int m_oldValue;
	/** new value being referenced */
	int m_newValue;
protected:
	Action_ChangeReferences(int * a_reference, int a_newValue)
		:m_referenceChanged(a_reference),m_oldValue(*a_reference),m_newValue(a_newValue){}
	bool redo(){	if(m_reference)*m_reference = m_newValue;	}
	bool undo(){	if(m_reference)*m_reference = m_oldValue;	}
	bool isActualChange(){return m_reference && m_oldValue != m_newValue;}
};